﻿
function checkall()
{ 
      var  email=vm.UserEmail.value;

      if(checkspace(document.vm.UserID.value)){   
          document.getElementById('UserIdCfm').value = "用户名不能为空";  
		  document.getElementById('UserIdCfm').style.color='#FF3333';
          document.vm.UserID.focus();
          return false;
        }  
      else if(!/^[a-zA-Z]/.test(document.vm.UserID.value)){   
          document.getElementById('UserIdCfm').value = "用户名不合法";
		  document.getElementById('UserIdCfm').style.color='#FF3333';
          document.vm.UserID.focus();
          return false;
        }     
      else if(checkspace(document.vm.UserPassword.value)){   
          document.getElementById('UserPasswordCfm').value = "密码不能为空"; 
		  document.getElementById('UserPasswordCfm').style.color='#FF3333';
          document.vm.UserPassword.focus();
          return false;
          }
          
      else if(document.vm.UserPassword.value.length<6){   
          alert("输入密码不能少于6位");
          document.getElementById('UserPasswordCfm').value = "输入密码不能少于6位";  
          document.vm.UserPassword.focus();
          return false;
          }
          
      else if(checkspace(document.vm.UserPasswordConfirm.value)){   
            alert("请输入确认密码");
            document.getElementById('UserPasswordConfirmCfm').value = "确认密码不为空";
            document.vm.UserPasswordConfirm.focus();
            return false;
            }  
      else if(document.getElementById('UserPasswordConfirm').value != document.getElementById('UserPassword').value){
                 alert("请重新输入确认密码");
                 document.getElementById('UserPasswordConfirmCfm').value = "两次输入密码不一致，请重新输入";
                 vm.UserPasswordConfirm.focus();
                 return false;
                 }

      else if(checkspace(document.vm.UserEmail.value)){
             alert("请输入邮箱");
             document.getElementById('UserEmailCfm').value = "邮箱不能为空"; 
             document.vm.UserEmail.focus();
             return false;
             }
      else if(!/^[a-zA-Z0-9_-]+@[a-zA-Z0-9_-]+(\.[a-zA-Z]+)+$/.test(email)) {
                alert("请输入邮箱");
                document.getElementById('UserEmailCfm').value = "邮箱格式不正确"; 
                document.vm.UserEmail.focus();
                return false;
              }
    else{
        SendRegInfor();
	}
 }
  

function   checkspace(checkstr)   {   
      var   str ='';   
      for(i   =   0;   i   <   checkstr.length;   i++)   {   
          str   =   str + ' ';  
      }   
      return   (str == checkstr);   
  }   

    